#pragma once
#include <vector>
#include "string.h"
#include <iostream>
#include ".\datastore2.h"

using namespace std;

//Class for work with DBMSCore
class dbcore {
public:
	//Simple SELECT. Select all date from table without condition(s)
	vector< vector<char*> > Select(char* nameOfTable);

	//Select data from table with some condition(s)
	vector< vector<char*> > Select(char* nameOfTable, vector<char*> nameOfColumn, vector<char*> operand, vector<char*> value);
	
	//Insert data to table
	void Insert ( char* nameOfTable, vector<char*> data);
	
	//Delete data from table
	void Delete(char* nameOfTable, char* nameOfColumn, vector<std::string> idColumns);
	
	//Update data in table
	void Update(char* nameOfTable, char* nameOfColumn, vector<std::string> idColumns, char* updateColumn, char* value);
	
	//Join two tables
	vector < vector<char*> > Join(vector< vector<char*> > table1, vector< vector<char*> > table2, char* tableName);
	
	//Super Join :)
	vector < vector<char*> > superJoin(vector<char*> tablesList, vector< vector<char*> > result);
	
	//Select for vector<vector>
	vector < vector<char*> > Select(vector< vector<char*> > result, vector<char*> nameOfColumn, vector<char*> operand, vector<char*> value );
    
	//Select for JOIN. For example, table.col = table2 = col
	vector < vector<char*> > Select(vector< vector<char*> > result, char* nameOfColumn1, char* nameOfColumn2);
	
	//Select for some columns
	vector < vector<std::string> > Select(vector< vector<std::string> > resultTable, vector<char*> namesOfColumns);

	//Get column type 
	char* getColumnType(char* nameOfTable, char* nameOfColumn);

	std::string getColumnTypeString(char* nameOfTable, char* nameOfColumn);
	
	//Count real vector size
	int countVector(vector<char*> vector);
	
	//Vector to string
	std::string vectorToString(vector< vector<char *> > vector);
	std::string vectorToString(vector< vector<std::string> > vector);

private:

};